//
//  PurchaseReuploader.swift
//  GhostWorld
//
//  Created by Kam on 2018/6/18.
//  Copyright © 2018 LKGood. All rights reserved.
//

import Foundation

class PurchaseUploader {
  
  // MARK: - Singleton
  static let shared = PurchaseUploader()
  private init() { }
  
  func upload() {
    if let items = EntityManager.fetch(PurchaseUploadData.self, fetchType: .all) {
      if items.count > 0 {
        items.forEach {
          $0.uploadToServer()
        }
      } else {
        loggingPrint("All purchase info have been uploaded!")
      }
    } else {
      loggingPrint("All purchase info have been uploaded!")
    }
  }
}
